<template>
	<view class="go-top" @click="GoTop()">
		<text>回到顶部</text>
	</view>
</template>

<script>
	export default {
		name:"goTop",
		data() {
			return {
				
			};
		},
		methods: {
			GoTop() {
				uni.pageScrollTo({
					scrollTop:0,
					duration:200
				})
			}
		},
	}
</script>

<!--scoped：局部作用域-->
<!--lang: 指定使用sass语言-->
<style scoped lang="scss">
.go-top{
	//固定定位，定位到屏幕的右下角
	position: fixed;
	//rpx:响应式像素数,无论屏幕多大，都算750rpx来进行计算，屏蔽了不同设备的屏幕大小
	right: 20rpx;
	bottom: 180rpx;
	width: 110rpx;
	height: 110rpx;
	background-color: #fff;
	border: 1px solid #aaa;
	border-radius: 50%;
	text-align: center;
	opacity: .5;
	font-size: 38rpx;
	&:active{
		opacity: 1;
	}
}
</style>